﻿using UnityEngine;
using System.Collections;

namespace Room
{
    public class RCAIChariotDeath : RCAIChariotBase
    {
        float timer;
        protected override void OnEnter()
        {
            controller.owner.PlayAnim(ChariotAnimation.Die);
            var ani = controller.owner.lod.Model.GetComponent<Animation>();

            timer = ani.GetClip(ChariotAnimation.Die).length;
            controller.Spawn(RoomUnionFight.CHARIOT_DIE, timer);
           
        }

        protected override void OnLeave()
        {

        }

        protected override void OnTick()
        {
            timer -= Time.deltaTime;
            if(timer<=0f)
            {
                controller.owner.gameObject.SetActive(false);
            }
        }
    }
}